package com.youaishujuhui.devops.web.service.manage;

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.youaishujuhui.devops.web.dao.manage.SysResourceDao;
import com.youaishujuhui.devops.web.domain.manage.SysResource;;

@Service
public class SysResourceService {

	@Autowired
	private SysResourceDao sysResourceDao;
	
	public int total() {
		return sysResourceDao.total();
	}

	public List<SysResource> query(Map<String, Object> param) {
		return sysResourceDao.query(param);
	}

	public int countById(SysResource po) {
		return sysResourceDao.countById(po);
	}

	public SysResource insert(SysResource po) {
		return sysResourceDao.insert(po);
	}

	public SysResource findById(Integer id) {
		return sysResourceDao.findById(id);
	}

	public int update(SysResource po) {
		return sysResourceDao.update(po);
	}

	public void deleteById(Integer id) {
		sysResourceDao.deleteById(id);
	}

	public boolean containsResourceUris(String reqUri) {
		Set<String> uris = sysResourceDao.queryAllResourceUris();
		return uris.contains(reqUri);
	}

	public List<SysResource> resourceTree(Integer roleId) {
		return sysResourceDao.resourceTree(roleId);
	}
}
